﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPageAdvSrch.master" AutoEventWireup="True" Inherits="Search_AdvancedSearch" Title="PeDALS public search demonstration" Codebehind="AdvancedSearch.aspx.cs" %>
<%--<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>--%>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="server">
<h3>Advanced search</h3>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

    <div >
        <%--Provenance and Series--%>
        <asp:Label ID="Label1" runat="server" Text="Select provenance and series"></asp:Label>
        <br />
        <asp:DropDownList ID="DropDownProvenances" runat="server" Height="20px" DataTextField="SeriesText" 
            DataValueField="SeriesId"/><br />
 
        <%--Item Title--%>
    
       <asp:Label ID="Label2" runat="server" Text="Item title" style="line-height:150%"></asp:Label>
     <br />
        <asp:TextBox ID="ItemTitle0" runat="server" Height="20px"></asp:TextBox>
        <asp:DropDownList ID="ItemTitleConnector" runat="server" Height="20px">
            <asp:ListItem>And</asp:ListItem>
            <asp:ListItem Value="Or"></asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="ItemTitle1" runat="server" Height="20px"></asp:TextBox>
     
        <br />
     

        <%--Party to the Record--%>
   
        <asp:Label ID="Label3" runat="server" Text="Party to the record" style="line-height:150%"></asp:Label>
   <br />
        <asp:TextBox ID="ItemParty0" runat="server" Height="20px"></asp:TextBox>
        <asp:DropDownList ID="ItemPartyConnector" runat="server" Height="20px">
            <asp:ListItem>And</asp:ListItem>
            <asp:ListItem Value="Or"></asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="ItemParty1" runat="server" Height="20px"></asp:TextBox>
  
        <%--Geo Location--%>
        <br />
        <asp:Label ID="Label4" runat="server" Text="Geographic location" style="line-height:150%"></asp:Label>
        <br />
        <asp:TextBox ID="GeographicLocation0" runat="server" Height="20px"></asp:TextBox>
        <asp:DropDownList ID="GeographicLocationConnector" runat="server" Height="20px">
            <asp:ListItem>And</asp:ListItem>
            <asp:ListItem Value="Or"></asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="GeographicLocation1" runat="server" Height="20px"></asp:TextBox>
        <br />
        <%--Subject--%>
  
        <asp:Label ID="Label5" runat="server" Text="Series subject" style="line-height:150%"></asp:Label>
        <br />
        <asp:TextBox ID="SeriesSubject0" runat="server" Height="20px"></asp:TextBox>
        <asp:DropDownList ID="SeriesSubjectConnector" runat="server" Height="20px">
            <asp:ListItem>And</asp:ListItem>
            <asp:ListItem Value="Or"></asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="SeriesSubject1" runat="server" Height="20px"></asp:TextBox>
        <br />
        <%--Keyword--%>
      
        <asp:Label ID="Label6" runat="server" Text="Series keyword" style="line-height:150%"></asp:Label>
        <br />
        <asp:TextBox ID="SeriesKeyword0" runat="server" Height="20px"></asp:TextBox>
        <asp:DropDownList ID="SeriesKeywordConnector" runat="server" Height="20px">
            <asp:ListItem>And</asp:ListItem>
            <asp:ListItem Value="Or"></asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="SeriesKeyword1" runat="server" Height="20px"></asp:TextBox>
        <br />
        <%--Date Range--%>
       
        <asp:Label ID="Label7" runat="server" Text="Date range" style="line-height:150%"></asp:Label>
        <br />
        <asp:TextBox ID="DateRange0" runat="server"></asp:TextBox>
        <asp:TextBox ID="DateRange1" runat="server"></asp:TextBox>
        <%--Search Button--%>
        <br />
        <br />
        <asp:Button ID="btnAdvSearch" runat="server" Height="26px" Text="Search" 
            onclick="btnAdvSearch_Click"/>
        <br />
    </div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
            <%-- Provenance Repeater for Search Results --%>
            <h2><asp:Label ID="lblProvenanceHeader" Visible="false" runat="server" Text="Provenance Matches"></asp:Label></h2>
            <div>
            <asp:Label ID="lblNoProvenance" Visible="false" runat="server" Text=""></asp:Label>
        <asp:ListView ID="provListView" runat="server" EnableViewState="False" Visible="False" >
        <LayoutTemplate>
          <table cellpadding="2" width="640px" border="1" ID="tbl1" runat="server">
            <tr id="Tr1" runat="server" style="background-color: #FFFFFF">
              <th id="Th1" runat="server">Provenance</th>
            </tr>
            <tr runat="server" id="itemPlaceholder" />
          </table>
          <asp:DataPager ID="Pager" runat="server"  
                   PagedControlID="provListView" PageSize="5" >                       
        <Fields>
            <asp:numericpagerfield ButtonCount="10" NextPageText="..." 
                PreviousPageText="..." />
            <asp:nextpreviouspagerfield FirstPageText="First" LastPageText="Last" 
                NextPageText="Next" PreviousPageText="Previous" />
        </Fields>
    </asp:DataPager>
          <%--<asp:DataPager ID="DataPager1" runat="server" PagedControlID="provListView" 
            PageSize="20" EnableViewState="True">
            <Fields>
                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                    ShowLastPageButton="True" />
            </Fields>
        </asp:DataPager>--%>
        </LayoutTemplate>
        <ItemTemplate>
          <tr id="Tr2" runat="server">
            <td>
              <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "ProvenanceId", "~/Browse/ProvenanceDetail.aspx?query={0}")%>'> <%# DataBinder.Eval(Container.DataItem, "ProvenanceName")%></asp:HyperLink>
            </td>
          </tr>
        </ItemTemplate>
        </asp:ListView>
    </div>
    
    
    <%--Series Repeater for Search Results--%>
        <h2><asp:Label ID="lblSeriesHeader" Visible="false" runat="server" Text="Series Matches"></asp:Label></h2>
    <div>
        <asp:Label ID="lblNoSeries" Visible="false" runat="server" Text=""></asp:Label>
            <asp:ListView ID="seriesListView" runat="server" OnPreRender="seriesList_PreRender" >
        <LayoutTemplate>
          <table cellpadding="2" width="640px" border="1" ID="tbl1" runat="server">
            <tr id="Tr1" runat="server" style="background-color: #FFFFFF">
              <th id="Th1" runat="server">Provenance / series title</th>
            </tr>
            <tr runat="server" id="itemPlaceholder" />
          </table>
          <asp:DataPager ID="DataPager1" runat="server" PagedControlID="seriesListView" PageSize="8" >                       
            <Fields>
                <asp:numericpagerfield ButtonCount="5" NextPageText=" >" PreviousPageText="< " ButtonType="Link" />
                <asp:nextpreviouspagerfield FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
            </Fields>
          </asp:DataPager>
        </LayoutTemplate>
        <ItemTemplate>
          <tr id="Tr2" runat="server">
            <td>
              <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "SeriesId", "~/Browse/ProvenanceDetail.aspx?query={0}")%>'> <%# DataBinder.Eval(Container.DataItem, "ProvenanceName")%> / <%# DataBinder.Eval(Container.DataItem, "SeriesTitle")%></asp:HyperLink>
            </td>
          </tr>
        </ItemTemplate>
        </asp:ListView>
    </div>
    
    <%--Item Repeater for Search Results--%>
    <h2><asp:Label ID="lblItemHeader" Visible="false" runat="server" Text="Item Matches"></asp:Label></h2>
    <div>
        <asp:Label ID="lblNoItem" Visible="false" runat="server" Text=""></asp:Label>
            <%--<asp:Repeater ID="rptItemResults" Visible="false" runat="server">
                <ItemTemplate>
                    <li><asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "ItemId", "~/Browse/Item.aspx?query={0}")%>'> <%# DataBinder.Eval(Container.DataItem, "ItemTitle") %></asp:HyperLink></li>
                </ItemTemplate>
            </asp:Repeater>--%>
        <asp:ListView ID="itmListView" runat="server" OnPreRender="itmList_PreRender" >
        <LayoutTemplate>
          <table cellpadding="2" width="640px" border="1" ID="tbl1" runat="server">
            <tr id="Tr1" runat="server" style="background-color: #FFFFFF">
              <th id="Th1" runat="server">Items</th>
              <%--<th id="Th2" runat="server"></th>--%>
            </tr>
            <tr runat="server" id="itemPlaceholder" />
          </table>
          <asp:DataPager ID="DataPager2" runat="server" PageSize="8" >                       
            <Fields>
                <asp:numericpagerfield ButtonCount="5" NextPageText=" >" PreviousPageText="< " ButtonType="Link" />
                <asp:nextpreviouspagerfield FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
            </Fields>
          </asp:DataPager>
        </LayoutTemplate>
        <ItemTemplate>
          <tr id="Tr2" runat="server">
            <td>
              <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "ItemId", "~/Browse/Item.aspx?query={0}")%>'> <%# DataBinder.Eval(Container.DataItem, "ItemTitle") %></asp:HyperLink>
            </td>
            <%--<td>--%>
              <%--The following line was commented out by Matt Guzzi
              <asp:Label ID="Label1" runat="server" Text='<%# Eval("ItemId") %>' />--%>
              <%--<asp:Button ID="btnDownload" runat="server" Text="Download" />
            </td>--%>
          </tr>
        </ItemTemplate>
        </asp:ListView>
    </div>
    <%--<div>
    <asp:DataPager ID="Pager" runat="server"  
                   PagedControlID="itmListView" PageSize="8" >                       
        <Fields>
            <asp:numericpagerfield ButtonCount="5" NextPageText=" >" 
                PreviousPageText="< " ButtonType="Link" />
         <asp:nextpreviouspagerfield FirstPageText="First" LastPageText="Last" 
                NextPageText="Next" PreviousPageText="Previous" />
        </Fields>
    </asp:DataPager>
    </div>--%>
    
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
